# Maintainer: Simon Rupf <simon@rupf.net>
pkgname=sequoia-sq
pkgver=0.35.0
pkgrel=0
pkgdesc="Command-line frontends for Sequoia"
url="https://gitlab.com/sequoia-pgp/sequoia-sq"
# rust-ring
arch="all !ppc64le !s390x !riscv64"
license="GPL-2.0-or-later"
makedepends="
	bzip2-dev
	capnproto-dev
	cargo
	cargo-auditable
	clang-dev
	openssl-dev
	sqlite-dev
	"
checkdepends="bash"
subpackages="
	$pkgname-doc
	$pkgname-bash-completion
	$pkgname-fish-completion
	$pkgname-zsh-completion
	"
source="https://gitlab.com/sequoia-pgp/sequoia-sq/-/archive/v$pkgver/sequoia-sq-v$pkgver.tar.bz2"
builddir="$srcdir/sequoia-sq-v$pkgver"
options="net" # cargo deps

export CARGO_PROFILE_RELEASE_LTO=thin

prepare() {
	default_prepare

	cargo fetch --target="$CTARGET" --locked
}

build() {
	export CARGO_TARGET_DIR=target
	cargo auditable build --frozen --release --no-default-features --features crypto-openssl
}

check() {
	cargo test --frozen --no-default-features --features crypto-openssl
}

package() {
	install -Dm755 target/release/sq \
		-t "$pkgdir"/usr/bin/
	install -Dm644 target/release/build/sequoia-sq-*/out/shell-completions/_sq \
		"$pkgdir"/usr/share/zsh/site-functions/_sq
	install -Dm644 target/release/build/sequoia-sq-*/out/shell-completions/sq.bash \
		"$pkgdir"/usr/share/bash-completion/completions/sq
	install -Dm644 target/release/build/sequoia-sq-*/out/shell-completions/sq.fish \
		"$pkgdir"/usr/share/fish/vendor_completions.d/sq.fish
	install -Dm644 target/release/build/sequoia-sq-*/out/man-pages/*.1 \
		-t "$pkgdir"/usr/share/man/man1/
}

sha512sums="
18439273ef3811c57d71a88ce7e10d25fd3ecfc26820f9a8827298bd170583574dba49e178ba7318e2e22ad645331d441db62e78e2e5879758722f00f22dfb75  sequoia-sq-v0.35.0.tar.bz2
"
